const { STRING } = require("sequelize")
const sequelize = require("../sequelize")
const achievement = require("./achievement")
const testpaper = sequelize.define("testpaper", {
    title: {
        type: STRING,
        allowNull: false,
        unique: true,
        comment: "试卷名称"
    },
    cover: {
        type: STRING,
        comment: "试卷封面"
    },
    choice: {
        type: STRING,
        comment: "选择题数组"
    },
    choicebranch: {
        type: STRING,
        comment: "选择题单单题分数"
    },
    answer: {
        type: STRING,
        comment: "简答题数组"
    },
    answerbranch: {
        type: STRING,
        comment: "简答题单单题分数"
    },
    conpletion: {
        type: STRING,
        comment: "填空题数组"
    },
    conpletionbranch: {
        type: STRING,
        comment: "填空题单单题分数"
    },
    judge: {
        type: STRING,
        comment: "判断题数组"
    },
    judgebranch: {
        type: STRING,
        comment: "判断题单单题分数"
    },
    createdate: {
        type: STRING,
        comment: "创建时间"
    },
    creator: {
        type: STRING,
        comment: "创建者"
    },
    updator: {
        type: STRING,
        comment: "修改者"
    },
    updated: {
        type: STRING,
        comment: "修改时间"
    },
    starttime: {
        type: STRING,
        comment: "开始答题时间"
    },
    endtime: {
        type: STRING,
        comment: "结束答题时间"
    },
    istest: {
        type: STRING,
        comment: "是否可以答题"
    },
    totalscore: {
        type: STRING,
        comment: "总分"
    },
    choicetotal: {
        type: STRING,
        comment: "选择题总分"
    },
    answertotal: {
        type: STRING,
        comment: "简答题总分"
    },
    conpletiontotal: {
        type: STRING,
        comment: "填空题总分"
    },
    judgetotal: {
        type: STRING,
        comment: "判断题总分"
    },
}, {
    timestamps: false
})

// testpaper.associate = () => {

    testpaper.hasMany(achievement)
// }

module.exports = testpaper